# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-net-rawip
_pkgname=Net-RawIP
pkgver=0.25
pkgrel=16
pkgdesc='Perl extension to manipulate raw IP packets with interface to B<libpcap>.'
arch=('x86_64' 'aarch64')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('libpcap' 'perl')
url='http://search.cpan.org/dist/Net-RawIP'
source=("http://search.cpan.org/CPAN/authors/id/S/SA/SAPER/$_pkgname-$pkgver.tar.gz"
        'fixes.patch')
sha512sums=('c48c77389db9dc8d5c64d67e5c62bac5e3314dbc36bcfa51aa20d07224492edaa65f5c71d47ca0b804ac62b1b02387e172cd3561eadaa3a1a8040968b182b3ca'
            'a87c4fe0552e95d8a331c75036bd1fc8f2359ead8a4ce75529af0f9668729699165acf8bf8b57cd347d571b9f1545f58d82cbfbf50920aea8cfb95c4649410a3')

prepare() {
  cd "$_pkgname-$pkgver"

  patch -Np2 -b -z .orig <../fixes.patch
}

build() {
  cd "$_pkgname-$pkgver"

  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor

  make
}

package() {
  cd "$_pkgname-$pkgver"

  make DESTDIR="$pkgdir" install

  find "$pkgdir" -name '.packlist' -o -name '*.pod' -delete
}

